package model

import (
	"gorm.io/gorm"
	"time"
)

type Comment struct {
	Id        uint           `gorm:"column:id;type:bigint(20);primaryKey;not null;" json:"id"`
	UserId    uint           `gorm:"column:user_id;type:bigint(20) UNSIGNED;comment:用户Id;not null;" json:"user_id"`       // 用户Id
	OnlineId  uint           `gorm:"column:online_id;type:bigint(20) UNSIGNED;comment:商品Id;not null;" json:"online_id"`   // 商品Id
	CollectId uint           `gorm:"column:collect_id;type:bigint(20) UNSIGNED;comment:收藏Id;not null;" json:"collect_id"` // 收藏Id
	Content   string         `gorm:"column:content;type:varchar(255);comment:评论;not null;" json:"content"`                // 评论
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" json:"deleted_at"`
}

func (c *Comment) TableName() string {
	return "comment"
}
